var CryptoJS = require('crypto-js')

function tripleAesEncrypt() {
    var key = CryptoJS.enc.Utf8.parse(aesKey),
        iv = CryptoJS.enc.Utf8.parse(aesIv),
        srcs = CryptoJS.enc.Utf8.parse(text),
        // CBC 加密方式，Pkcs7 填充方式
        encrypted = CryptoJS.AES.encrypt(srcs, key, {
            iv: iv,
            mode: CryptoJS.mode.CBC,
            padding: CryptoJS.pad.Pkcs7
        });
    return encrypted.toString();
}

function tripleAesDecrypt() {
    var key = CryptoJS.enc.Utf8.parse(aesKey),
        iv = CryptoJS.enc.Utf8.parse(aesIv),
        srcs = encryptedData,
        // CBC 加密方式，Pkcs7 填充方式
        decrypted = CryptoJS.AES.decrypt(srcs, key, {
            iv: iv,
            mode: CryptoJS.mode.CBC,
            padding: CryptoJS.pad.Pkcs7
        });
    return decrypted.toString(CryptoJS.enc.Utf8);
}

var text = "{'rt': 'fp=C9A79A-8C874D-DB08B6&vid=1733365254563.a589R82d4F5X&pageId=10320670296&r=742e020d838747fabb39213b14c1eaeb&ip=61.136.204.101&rg=fin&kpData=0_0_0&kpControl=0_0_0-0_0_0&kpEmp=0_0_0_0_0_0_0_0_0_0-0_0_0_0_0_0_0_0_0_0-0_0_0_0_0_0_0_0_0_0&screen=1920x1080&tz=+8&blang=zh-CN&oslang=zh-CN&ua=Mozilla%2F5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F131.0.0.0%20Safari%2F537.36&d=passport.ctrip.com&v=25&kpg=0_0_0_1_28582_25_0_0_0_0&adblock=F&cck=F', 'ua': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36', 'p': 'pc', 'fp': 'C9A79A-8C874D-DB08B6', 'vid': '1733365254563.a589R82d4F5X', 'sfp': None, 'identify': 'aC9A79A-8C874D-DB08B6', 'svid': None, 'guid': '09031105311803569409', 'h5_duid': 'BFCFF94243E8CA207D8C4D793FAC8FAC', 'pc_duid': None, 'hb_uid': None, 'pc_uid': None, 'h5_uid': None, 'infosec_openid': None, 'device_id': 'f1f07e81036b5b74fcf245e1fc67977f', 'client_id': 'QZSHtpSHOfuzbBNpia2ucW9K4OAXXatE', 'pid': '3119029742355624', 'sid': 'rnpLvkPzKgoqsoVD', 'login_uid': '13D55A65232C2ADC236C46C6D2784027FA6066533908BEB8461D8D422EB69B08', 'client_type': 'PC', 'site': {'type': 'PC', 'url': 'https://passport.ctrip.com/user/login?BackUrl=https%3A%2F%2Fwww.ctrip.com%2F#ctm_ref=c_ph_login_buttom', 'ref': '', 'title': '登录首页', 'keywords': ''}, 'device': {'width': 1920, 'height': 1080, 'os': '', 'pixelRatio': 1, 'did': ''}, 'user': {'tid': '', 'uid': '', 'vid': ''}}"    // 待加密对象
var aesKey = "3f3a7c0f49fa89a01457c45323411831"   // 密钥，16 倍数
var aesIv = "69e0708676b3a0bc4e008bda6b59d6e1"    // 偏移量，16 倍数

var encryptedData = tripleAesEncrypt()
var decryptedData = tripleAesDecrypt()

console.log("加密字符串: ", encryptedData)
console.log("解密字符串: ", decryptedData)